class_name MySprites
extends StaticBody2D

@export var health: int = 100
@export var attack: int = 20
@export var defence: int = 10
@export var is_player: bool = true
@export var anger: int = 0
@export var physical_location: int = 0
@export var is_current_turn_played: bool = false

func turn(players: Array, enemies: Array) -> void:
	is_current_turn_played = true
	if anger >= 4:
		use_ultimate_ability(players, enemies)
		anger -= 4
	elif anger < 4:
		use_basic_ability(players, enemies)
		anger += 2

func get_one_random_my_sprite(my_sprites: Array) -> StaticBody2D:
	var valid_sprites: Array = []
	for sprite in my_sprites:
		if sprite.health > 0:
			valid_sprites.append(sprite)
	if valid_sprites.size() > 0:
		return valid_sprites[randi() % valid_sprites.size()]
	return null

func get_first_alive_my_sprite(my_sprites: Array) -> StaticBody2D:
	for sprite in my_sprites:
		if sprite.health > 0:
			return sprite
	return null
	
func use_ultimate_ability(_players: Array, _enemies: Array) -> void:
	pass
	
func use_basic_ability(_players: Array, _enemies: Array) -> void:
	pass
	
func my_sprite_killed() -> void:
	pass
